package ssm.pojo;

import java.util.List;

public class PageBean<T> {
    private int number;//当前页码
    private int allnumber;//总页数 通过计算获得
    private int total;//每页显示条数
    private int alltotal;//总条数 数据库查询
    private List<T> list;//每页查询的表数据 数据库查询

    public PageBean() {
    }

    public PageBean(int number, int total, int alltotal, List<T> list) {
        this.number = number;
        this.total = total;
        this.alltotal = alltotal;
        this.list = list;
        this.allnumber=(alltotal%total==0)?(alltotal/total):(alltotal/total+1);
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public int getAllnumber() {
        return allnumber;
    }

    public void setAllnumber(int allnumber) {
        this.allnumber = allnumber;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getAlltotal() {
        return alltotal;
    }

    public void setAlltotal(int alltotal) {
        this.alltotal = alltotal;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    @Override
    public String toString() {
        return "PageBean{" +
                "number=" + number +
                ", allnumber=" + allnumber +
                ", total=" + total +
                ", alltotal=" + alltotal +
                ", list=" + list +
                '}';
    }
}
